<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<link rel="stylesheet" type="text/css" href="../css/landing.css"/>
	</head>
	<body>
	<div id="All">
		<div class="top">
				<ul class="clearfix">
					<li><a href="">登录</a></li>
					<li><a href="">注册</a></li>
					<li><a href="">X</a></li>
				</ul>
		</div>
			
		<div class="bot">
				<ul>
					<li>
						用户名：<input id = "input1" type="text" placeholder="请输入英文字母或数字" />			
						<span id="sname"></span>
					</li>
					<li>
							<span>密码：</span>	
							<input id = "password1" type="password" placeholder="填写六到十二位的英文和数字" />
							<span id="sword1"></span>
					</li>
					<li>
						<span>验证码：</span>
						<input id = "input2" type="text" placeholder="填写验证码">
						<span id="syzm" id="验证码生成"></span>
						<span id="syzm2">看不清楚？换一个</span>
					</li>
					<li>
						<input type="checkbox" /><span>记住账号</span><input class = "che" type="checkbox" />两周后自动登录
					</li>
					<li>
						<div><a href="">登录</a></div>
					</li>
				</ul>	
			</div>
		</div>
	</body>
	
	<script>
		//		用户名验证：
		function Un(){
		var usename=input1.value;
			if(usename!=""){
				var flag=true;
				for( var i in usename){
					var chr= usename.charCodeAt(i)
						var codea = chr<=122 && chr>=97
						var codeA = chr<=90 && chr>=65
						var code0 = chr<=57 && chr>=48
					if( codea|| codeA  || code0){
						
					}else{
						flag=false;
						break;	
					}
				}
				if(flag){
					sname.innerHTML=" ";
					sname.className="success"
				}else{
					sname.innerHTML="请输入英文字母或数字";
					sname.className="error"
				}	
			}else{
				sname.innerHTML=" "
				sname.className="error"
			}
		}
		input1.onblur=function(){
			Un();
		}
		
		//密码验证
		function Pw(){
			var p1=password1.value;
			var p2=password2.value;
			var len=p1.length;
			if(len>=6 && len<=12){
				sword1.innerHTML=" "
				sword1.className="success"
				if(p2==p1){
					sword2.innerHTML=" "
					sword2.className="success"
				}else{
					sword2.innerHTML="密码不一致，请重新输入"
					sword2.className="error"
				}
			
			}else{
				sword1.innerHTML="密码应大于六位";
				sword1.className="error";
				
			}
			if(p2==""){
				sword2.innerHTML="";
				sword2.className="";
			}
		}
		password1.onblur=Pw;
		password2.onblur=Pw;
		
		
		
		
		
		
		/验证码制作：

	function Yzm(){
		var str="abcdefghijkmnpqrstuvwxyz23456789ABCDEFGHJKLMNPQRSTUVWXYZ"
		var len=str.length;
		var i1=parseInt( Math.random()*len );
		var i2=parseInt( Math.random()*len );
		var i3=parseInt( Math.random()*len );
		var i4=parseInt( Math.random()*len );
		return str[i1]+str[i2]+str[i3]+str[i4];	
	}
	syzm.innerHTML=Yzm();
	syzm.onclick=function(){
		syzm.innerHTML=Yzm();
	}
		
//验证码输入
function yanzheng(){
	var m=input2.value;
	  	n=syzm.innerHTML
	if( m.toLowerCase()==n.toLowerCase() ){
		syzm2.innerHTML="验证码输入正确"
		syzm2.className="success"
	}else{
		syzm2.innerHTML="验证码输入错误，请重新输入"
		syzm2.className="error"
		
	}if(m==""){
		syzm2.innerHTML="请输入验证码"
		syzm2.className="error"
	}
	
}
input2.onblur=function(){
	yanzheng();
	
}
	</script>
</html>
